This repository has been archived by the owner on Jan 12, 2021. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After a fresh clone/install of the project
npm test
is failing on some tests, when testing equality of array fixture v.s array produced by test.The array content is similar to the fixture one, but not ordered the same way, failing jest
expect.toEqual
call.After looking into it, it's just due to an incorrect implementation of the
compareFunction
provided tosort
function. This function should return either1
(if a > b),-1
(if a < b) or0
(if a === b), but current implementation was returning a bool being coerced to0
(if false) or1
(if true), leading to the problem.Please note that this failure wasn't noticed before because it is dependent on the version of node being used. I was running current LTS (12.15.0) when running into this test failure, but the test failure does not appear when running Node 8 (I didn't try other versions, so not sure from which version it appears). Probably due to a different internal implementation of the
sort
function in recent node versions, dealing a bit differently with ordering of identical values.